//package com.tuya.iot.suite.web.config.session;
//
//import com.tuya.iot.suite.web.util.SessionContext;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.session.config.annotation.web.http.EnableSpringHttpSession;
//
//@Configuration
//@EnableSpringHttpSession
//public class HttpSessionConfig {
//
//    @Value("${server.session.timeout}")
//    private Integer timeout;
//
//    /**
//     * session策略，这里默认会从头部，请求参数中获取内容
//     * 这里的token 可以自定义，主要用于请求参数的名字
//     *
//     * @return
//     */
//    @Bean
//    public HttpSessionStrategy httpSessionStrategy() {
//        return new HttpSessionStrategy(SessionContext.USER_TOKEN_ATTR_NAME);
//    }
//
//    /*@Bean
//    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
//        RedisTemplate<String, Object> template = new RedisTemplate<>();
//        template.setConnectionFactory(redisConnectionFactory);
//
//        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
//
//        ObjectMapper objectMapper = new ObjectMapper();
//        objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
//        objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
//        jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
//
//        // 设置key和value的序列化规则
//        //template.setValueSerializer(jackson2JsonRedisSerializer);
//        template.setValueSerializer(new JdkSerializationRedisSerializer());
//        template.setKeySerializer(new StringRedisSerializer());
//        template.afterPropertiesSet();
//
//        return template;
//    }*/
//
//    /*@Bean
//    RedisSessionRepository sessionRepository(RedisTemplate<String, Object> redisTemplate) {
//        return new RedisSessionRepository(redisTemplate, timeout);
//    }*/
//}
